//unity4都是用lambert

Shader "Custom/SimpleLambert" {
	Properties {
		_MainTex ("Base (RGB)", 2D) = "white" {}
		_Color("Color",Color)=(1,1,1,1)
	}
	SubShader {
		Tags { "RenderType"="Opaque" }
		LOD 200

		CGPROGRAM
		#pragma surface surf SimpleLambert //自己写的，不是用系统的
		sampler2D _MainTex;     

		struct Input {
			float2 uv_MainTex;
		};

        sampler2D _MainTex;

		void surf (Input IN, inout SurfaceOutput o) {
			o.Albedo = tex2D (_MainTex, IN.uv_MainTex);
		}
//自己写的光照模型
		half4 LightingSimpleLambert(SurfaceOutput s, half3 lightDir, half atten)
		{
			half f= max(dot(s.Normal, lightDir), 0.0); // 避免光照结果小于0
            half4 c;
			c.rgb = s.Albedo * _LightColor0.rgb * (f * atten ); //第0个光源的颜色，unity预定义
			c.a = s.Alpha; 
			return c;
		}
		ENDCG
	}
}

//ramp斜坡纹理